﻿using Me.Amon.POS.C;

namespace Me.Amon.POS.M
{
    /// <summary>
    /// 商品信息
    /// </summary>
    public class MSpu : MPos
    {
        public string corp_id;
        /// <summary>
        /// 商品名称
        /// </summary>
        public string name;
        /// <summary>
        /// 汉语拼音
        /// </summary>
        public string hypy;
        /// <summary>
        /// 商品编号（商家）
        /// </summary>
        public string merchant_code;
        /// <summary>
        /// 商品名称（商家）
        /// </summary>
        public string merchant_name;
        /// <summary>
        /// 规格
        /// </summary>
        public string spec;
        /// <summary>
        /// 型号
        /// </summary>
        public string mode;
        /// <summary>
        /// 计量单位
        /// </summary>
        public string uom_id;
        public string brand_id;
        public string brand;
        /// <summary>
        /// 商家
        /// </summary>
        public string merchant_id;
        /// <summary>
        /// 组合商品
        /// </summary>
        public string pid;
        /// <summary>
        /// 组合数量
        /// </summary>
        public int pqty;
        /// <summary>
        /// 系列商品
        /// </summary>
        public string sid;
        /// <summary>
        /// 系列数量
        /// </summary>
        public int sqty;
        /// <summary>
        /// 库存上限
        /// </summary>
        public int max_inv;
        /// <summary>
        /// 库存下限
        /// </summary>
        public int min_inv;
        /// <summary>
        /// 有效期年
        /// </summary>
        public int valid_year;
        /// <summary>
        /// 有效期月
        /// </summary>
        public int valid_month;
        /// <summary>
        /// 有效期日
        /// </summary>
        public int valid_day;
        public int usable_inv;
        public int reject_inv;
        /// <summary>
        /// 是否促销
        /// </summary>
        public bool has_point;

        /// <summary>
        /// 是否会员
        /// </summary>
        public bool is_vip;
        public bool is_pro;

        public MSpuInv inv;

        /// <summary>
        /// 售价
        /// </summary>
        public MSpuPrice price;
        /// <summary>
        /// 条码
        /// </summary>
        public MSpuBarcode[] barcodes;

        public string GetIsPro()
        {
            switch (has_point)
            {
                case CSpu.IS_PRO_YES:
                    return "是";
                default:
                    return "否";
            }
        }

        public string GetIsVip()
        {
            switch (is_vip)
            {
                case CSpu.IS_VIP_YES:
                    return "是";
                default:
                    return "否";
            }
        }

        public override string ToString()
        {
            return name;
        }
    }
}
